/*
 * @Author: zhuxiaoyi
 * @Date: 2024-03-06 11:59:07
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2024-11-04 18:27:28
 * @Description:
 */
import {
  Body,
  Controller,
  Del,
  File,
  Get,
  Inject,
  Param,
  Post,
  Put,
  Query,
} from '@midwayjs/core';
import { Job, IJob } from '@midwayjs/cron';
import { FORMAT } from '@midwayjs/core';
import { TaskService } from '../service/task.service';
import { SimulationTaskService } from '../service/simulationTask.service';

@Job({
  cronTime: FORMAT.CRONTAB.EVERY_PER_30_SECOND,
  // start: true,
  start: false,
})
export class DataSyncCheckerJob implements IJob {

  @Inject()
  taskService:TaskService;
  async onTick() {
    // this.taskService.executeTaskByStatus() 
    this.taskService.executeProcessTaskByStatus()
  }
}

@Job({
  cronTime: FORMAT.CRONTAB.EVERY_PER_5_MINUTE,
  // start: true,
  start: false,
})
export class downloadRainfallJob implements IJob {

  @Inject()
  simulationTaskService:SimulationTaskService;
  async onTick() {
    console.log('每隔5分钟下载一次降雨数据')
    // this.simulationTaskService.downloadRainfallData()
  }
}


@Job({
  cronTime: FORMAT.CRONTAB.EVERY_HOUR,
  // start: true,
  start: false,
})
export class pushPreviewData implements IJob {
  @Inject()
  simulationTaskService:SimulationTaskService;
  async onTick() {
    // console.log('每隔一小时推送一次预警数据')
    // this.simulationTaskService.pushPreviewData()
    // this.simulationTaskService.pushPreviewData2()
  }
}

